package com.project.service.impl;

import com.project.bean.ManBean;
import com.project.mapper.IManMapper;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class) //表示该类中所有方法都支持事务管理
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper mapper;
    @Override
    public void add(ManBean man) {
        mapper.add(man);
//        int x = 9/0;
//        mapper.add(new ManBean("周二","女", LocalDate.parse("1998-02-03"),"13203928392"));
    }

    @Override
    public List<ManBean> findAll() {
        return mapper.findAll();
    }
}
